package EcologicalBinPacking102;

import java.util.Scanner;
import java.util.StringTokenizer;

public class MainCasoOptimo {

    private static int contenedores[][];
    private static int cantB = 0, cantG = 0, cantC = 0, mayor = 0, medio = 0, menor = 0;
    private static final int BROWN = 1, GREEN = 2, CLEAR = 3;
    private static Scanner consola = new Scanner(System.in);
    private static StringTokenizer st;
    private static StringBuilder sb;
    private static char bins[] = new char[3];

    public static void main(String args[]) {
        while (consola.hasNextLine()) {
            contenedores = new int[3][4];
            cantB = cantG = cantC = mayor = medio = menor = 0;
            sb = new StringBuilder();
            st = new StringTokenizer(consola.nextLine());

            cargarcontenedores();

            mayor = calcularMayor(cantB, cantG, cantC);
            medio = calcularMedio(mayor);
            menor = calcularMenor(mayor, medio);

            contenedores[enQueContenedorHayMasDelColor(mayor)][0] = mayor;
            contenedores[enQueContenedorHayMasDelColor(medio)][0] = medio;

            armarOrdenContenedores();

            calcularPasoDeBottelas();

            System.out.print(sb.toString());
            //if (consola.hasNextLine()) {
            System.out.print("\n");
            //}
        }



    }

    private static int calcularSobras(int contenedor, int color) {
        int r = 0;
        if (color == 0) {
            color = menor;
        }
        for (int i = 1; i <= 3; i++) {
            if (i != color) {
                r += contenedores[contenedor][i];
            }
        }
        return r;
    }

    private static void cargarcontenedores() {
        for (int i = 0; i < 3; i++) {//Contenedores
            for (int j = 1; j <= 3; j++) {//Colores
                switch (j) {
                    case 1:
                        cantB += contenedores[i][j] = Integer.parseInt(st.nextToken());
                        break;
                    case 2:
                        cantG += contenedores[i][j] = Integer.parseInt(st.nextToken());
                        break;
                    case 3:
                        cantC += contenedores[i][j] = Integer.parseInt(st.nextToken());
                        break;
                }

            }
        }
    }

    private static int enQueContenedorHayMasDelColor(int color) {
        int contenedor = 0, may = -1;
        for (int i = 0; i < 3; i++) {
            if (contenedores[i][color] > may && contenedores[i][0] == 0) {
                may = contenedores[i][color];
                contenedor = i;
            }
        }
        return contenedor;
    }

    private static int calcularMayor(int cantB, int cantG, int cantC) {
        if (cantB > cantG) {
            if (cantB > cantC) {
                return BROWN;
            } else {
                return CLEAR;
            }
        } else {
            if (cantG > cantC) {
                return GREEN;
            } else {
                return CLEAR;
            }
        }
    }

    private static int calcularMedio(int mayor) {
        switch (mayor) {
            case 1:
                if (cantG > cantC) {
                    return GREEN;
                } else {
                    return CLEAR;
                }
            case 2:
                if (cantB > cantC) {
                    return BROWN;
                } else {
                    return CLEAR;
                }
            case 3:
                if (cantB > cantG) {
                    return BROWN;
                } else {
                    return GREEN;
                }
            default:
                return -1;
        }
    }

    private static int calcularMenor(int mayor, int medio) {
        for (int i = 1; i <= 3; i++) {
            if (i != mayor && i != medio) {
                return i;
            }
        }
        return -1;
    }

    private static void armarOrdenContenedores() {
        for (int i = 0; i < 3; i++) {
            toStringColor(menor);
            switch (contenedores[i][0]) {

                case 0:
                    sb.append(toStringColor(menor));
                    break;
                case 1:
                    sb.append("B");
                    break;
                case 2:
                    sb.append("G");
                    break;
                case 3:
                    sb.append("C");
                    break;
            }
        }
        sb.append(" ");
    }

    private static String toStringColor(int menor) {
        switch (menor) {
            case 1:
                return "B";
            case 2:
                return "G";
            case 3:
                return "C";
            default:
                return "ERROR";
        }
    }

    private static void calcularPasoDeBottelas() {
        int paso = 0;
        for (int i = 0; i < 3; i++) {
            paso += calcularSobras(i, contenedores[i][0]);
        }
        sb.append(paso);
    }
}
